package com.bruce.service.impl;

import com.bruce.Common.Resultcode;
import com.bruce.bean.Teacher;
import com.bruce.dao.TeacherDao;
import com.bruce.dao.impl.TeacherDaoImpl;
import com.bruce.service.TeacherService;

public class TeacherServiceImpl implements TeacherService {

    TeacherDao teacherDao=new TeacherDaoImpl();

    @Override
    public Teacher teacherLogin(Teacher t) {
        return teacherDao.teacherLogin(t);
    }

    @Override
    public int addTeacher(Teacher teacher) {

        int i = teacherDao.addTeacher(teacher);
        if (i<1){
            throw new RuntimeException(Resultcode.Add_Error.getMess());
        }else {
            return i;
        }
    }

    @Override
    public Teacher findTeacherName(String tid) {
        return teacherDao.findTeacherName(tid);
    }

    @Override
    public boolean FindIsTeacheCoursed(String cid) {
        String s = teacherDao.FindIsTeacheCoursed(cid);
        if (s == null||s.equals(null)){
            return false;
        }
        return true;
    }

}
